#include "onlineAccMgr_t.h"
#include <threadSync_t.h>

void onlineAccMgr_t::addAccount(const string & account)
{
	threadSync_t ts(&m);
	if (findAccount(account).empty())
	{
		accounts.push_back(account);
	}
}


void onlineAccMgr_t::delAccount(const string & account)
{
	threadSync_t ts(&m);
	vector<string>::iterator iter;
	iter = find(accounts.begin(), accounts.end(), account);
	if (iter!=accounts.end())
	{
		accounts.erase(iter);
	}
}


string onlineAccMgr_t::findAccount(const string & account)
{
	threadSync_t ts(&m);
	vector<string>::iterator iter;
	iter = find(accounts.begin(), accounts.end(), account);
	if (iter==accounts.end()) return string();
	return *iter;
}